package org.cwnuit.train.utils;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import org.cwnuit.train.domain.Rules;
import org.cwnuit.train.domain.Trains;
import org.cwnuit.train.domain.Wtype;

public class MapUtil {
	/**
	 * 将车站信息放入map
	 * 
	 * @param trains
	 * @return
	 */
	public static Map<String, String> getTrainsMap(List<Trains> trains) {
		Map<String, String> data = new LinkedHashMap<String, String>();
		if (null != trains) {
			for (Trains train : trains) {
				data.put(train.getTname(), train.getTid() + "");
			}
		}
		return data;
	}
	
	public static Map<String, String> getWtypesMap(List<Wtype> wtypes) {
		Map<String, String> data = new LinkedHashMap<String, String>();
		if (null != wtypes) {
			for (Wtype wtype : wtypes) {
				data.put(wtype.getWname(), wtype.getWid() + "");
			}
		}
		return data;
	}
	
	public static Map<String, String> getRulesMap(List<Rules> rules) {
		Map<String, String> data = new LinkedHashMap<String, String>();
		if (null != rules) {
			for (Rules rule : rules) {
				data.put(rule.getRid()+"",rule.getRname());
			}
		}
		return data;
	}

}
